// N1Object.h: interface for the N1Object class.
//
//////////////////////////////////////////////////////////////////////
#ifndef N1OBJECT_H_2009_09
#define N1OBJECT_H_2009_09

#include "N1Types.h"
#include "N1BinStream.h"

#define N1NAME_DECL  virtual pcstr name() const ;

#define N1NAME_DEF(clsname)  pcstr clsname::name() const \
{ return #clsname; }


class N1Object {
public:
    virtual ~N1Object();

    virtual N1Object* retain();

    virtual N1Object* release();

    virtual N1UInt32  retainCounter() const;

    virtual bool isEqualTo(N1Object *obj);

    virtual pcstr name() const ;

    virtual pcstr description() const ;

    virtual N1Object* autorelease();

    virtual void serialize(N1Stream &stream, uint32 version) {};

    template<class T>
    T* autorelease()
    {
        autorelease();
        return static_cast<T*>(this);
    };

protected:
    N1Object();

private:
    N1UInt32 m_retainCounter;
};

#endif //N1OBJECT_H_2009_09
